<?php

namespace App\AdminModule\Presenters;

use Nette;

/**
 * Base presenter for all application presenters.
 */
abstract class BasePresenter extends Nette\Application\UI\Presenter {
  
  /**
   * Startup
   */
  public function startup() {
    parent::startup();
    
    if(!$this->getUser()->isLoggedIn() || $this->getUser()->isInRole('user')){
      $this->redirect(':Front:Homepage:default');
    }
    
    if($this->getUser()->isInRole('writer')){
      if($this->getName() != 'Article' && $this->getName() != 'Photo'){
        $this->redirect(':Front:Homepage:default');
      }
    }
  }
}
